<template>
  <ele-page>
    <ele-loading :loading="loading" text="数据准备中，请稍后...">
      <Step v-if="index!=-1" v-model="index" :key="index"></Step>
      <ele-card v-if="index!=-1">
        <ShowInfo v-if="index == 0" v-model="index"></ShowInfo>
        <CheckSource v-if="index == 1" v-model="index"></CheckSource>
        <BaseInfo v-if="index == 2" v-model="index"></BaseInfo>
        <RecommendInfo v-if="index == 3" v-model="index"></RecommendInfo>
        <CheckInfo v-if="index == 4" v-model="index"></CheckInfo>
        <End v-if="index == 5" v-model="index"></End>
      </ele-card>
    </ele-loading>
    <ele-card v-if="index==-1">
      <el-alert title="你的推荐表信息已被辅导员审核，如需修改，请联系辅导员取消审核" type="warning" :closable="false"
                show-icon/>
    </ele-card>
    <ele-card v-if="index==-1">
      <el-descriptions title="">
        <el-descriptions-item label="学生">{{ studentObject.name }}({{ studentObject.code }})</el-descriptions-item>
        <el-descriptions-item label="联系方式">{{ studentObject.phoneNumber }}</el-descriptions-item>
        <el-descriptions-item label="qq">{{ studentObject.qq }}</el-descriptions-item>
        <el-descriptions-item label="邮箱">{{ studentObject.email }}</el-descriptions-item>
        <el-descriptions-item label="政治面貌">{{ studentObject.politicalStatus }}</el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions>
        <el-descriptions-item label="技能证书">{{ studentObject.qualification }}</el-descriptions-item>
        <el-descriptions-item label="计算机等级">{{ studentObject.computerLevel }}</el-descriptions-item>
        <el-descriptions-item label="外语等级">{{ studentObject.foreignLanguageEvel }}</el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions>
        <el-descriptions-item label="求职意向">{{ studentObject.jobIntention }}</el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions :column="2">
        <el-descriptions-item label="家庭地址">{{ studentObject.homeAddress }}</el-descriptions-item>
        <el-descriptions-item label="家庭邮编">{{ studentObject.homeCode }}</el-descriptions-item>
        <el-descriptions-item label="家庭联系电话">{{ studentObject.homePhone }}</el-descriptions-item>
        <el-descriptions-item label="城乡生源">
          <el-tag type="primary" v-if="studentObject.isCityStudent == '1'">城镇</el-tag>
          <el-tag type="success" v-else>农村</el-tag>
        </el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions>
        <el-descriptions-item label="户口是否转入学校">
          <el-tag type="primary">{{ studentObject.isHkInSchool == '1' ? "未转入" : "已转入" }}</el-tag>
        </el-descriptions-item>
        <el-descriptions-item label="入学前户口所在单位">{{ studentObject.rxqhkszdpcs }}</el-descriptions-item>
        <el-descriptions-item label="入学前档案所在单位">{{ studentObject.rxqdaszdw }}</el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions :column="1">
        <el-descriptions-item label="在校荣誉1">{{ studentObject.rewardPunishmentPrize1 }}</el-descriptions-item>
        <el-descriptions-item label="在校荣誉2">{{ studentObject.rewardPunishmentPrize2 }}</el-descriptions-item>
        <el-descriptions-item label="在校荣誉3">{{ studentObject.rewardPunishmentPrize3 }}</el-descriptions-item>
        <el-descriptions-item label="在校荣誉4">{{ studentObject.rewardPunishmentPrize4 }}</el-descriptions-item>
        <el-descriptions-item label="在校荣誉5">{{ studentObject.rewardPunishmentPrize5 }}</el-descriptions-item>
      </el-descriptions>
      <el-divider/>
      <el-descriptions :column="1">
        <el-descriptions-item label="在校工作或实践经历1">{{ studentObject.workContent1 }}</el-descriptions-item>
        <el-descriptions-item label="在校工作或实践经历2">{{ studentObject.workContent2 }}</el-descriptions-item>
        <el-descriptions-item label="在校工作或实践经历3">{{ studentObject.workContent3 }}</el-descriptions-item>
        <el-descriptions-item label="在校工作或实践经历4">{{ studentObject.workContent4 }}</el-descriptions-item>
        <el-descriptions-item label="在校工作或实践经历5">{{ studentObject.workContent5 }}</el-descriptions-item>
      </el-descriptions>
    </ele-card>
  </ele-page>
</template>
<script setup>
import {ref, onMounted} from 'vue';
import {Plus, Delete, Upload, Download} from '@element-plus/icons-vue';
import {ElMessageBox} from 'element-plus/es';
import {EleMessage} from 'ele-admin-plus/es';
import ShowInfo from './components/show-info.vue';
import CheckSource from './components/check-source.vue';
import BaseInfo from './components/base-info.vue';
import RecommendInfo from './components/recommend-info.vue';
import Step from './components/step.vue';
import CheckInfo from './components/check-info.vue';
import End from './components/end.vue'

import {selectStudentRecommendInfo} from '@/api/student/index.js';
import {selectStudentCheckInfo} from "@/api/student";


const index = ref(0);
const loading = ref(true);//用于判断当前学生是否被锁定的遮罩

const studentObject = ref({});

onMounted(() => {
  selectStudentRecommendInfo().then(res => {
    if (res.data.counselorRecommendCheck == '0') {
      index.value = -1;
      selectStudentCheckInfo().then(res2 => {
        studentObject.value.name = res2.data.name;
        studentObject.value.code = res2.data.code;

        studentObject.value.phoneNumber = res2.data.phoneNumber;
        studentObject.value.politicalStatus = res2.data.politicalStatus;
        studentObject.value.qq = res2.data.qq;
        studentObject.value.qualification = res2.data.qualification;

        studentObject.value.computerLevel = res2.data.computerLevel;
        studentObject.value.email = res2.data.email;
        studentObject.value.foreignLanguageEvel = res2.data.foreignLanguageEvel;
        studentObject.value.homeAddress = res2.data.homeAddress;
        studentObject.value.homeCode = res2.data.homeCode;
        studentObject.value.homePhone = res2.data.homePhone;
        studentObject.value.isCityStudent = res2.data.isCityStudent;
        studentObject.value.isHkInSchool = res2.data.isHkInSchool;
        studentObject.value.jobIntention = res2.data.jobIntention;

        studentObject.value.rewardPunishmentPrize1 = res2.data.rewardPunishmentPrize1;
        studentObject.value.rewardPunishmentPrize2 = res2.data.rewardPunishmentPrize2;
        studentObject.value.rewardPunishmentPrize3 = res2.data.rewardPunishmentPrize3;
        studentObject.value.rewardPunishmentPrize4 = res2.data.rewardPunishmentPrize4;
        studentObject.value.rewardPunishmentPrize5 = res2.data.rewardPunishmentPrize5;

        studentObject.value.rxqdaszdw = res2.data.rxqdaszdw;
        studentObject.value.rxqhkszdpcs = res2.data.rxqhkszdpcs;

        studentObject.value.workContent1 = res2.data.workContent1;
        studentObject.value.workContent2 = res2.data.workContent2;
        studentObject.value.workContent3 = res2.data.workContent3;
        studentObject.value.workContent4 = res2.data.workContent4;
        studentObject.value.workContent5 = res2.data.workContent5;
      });
    } else {
      index.value = 0;
    }
    loading.value = false;
    console.log(res);
  });
})
</script>
